package process

import (
	"fmt"

	mark3labs "github.com/mark3labs/mcp-go/mcp"
)

type TopicTool struct {
}

func NewTopicTool() *TopicTool {
	return &TopicTool{}
}

func (t *TopicTool) GetName() string {
	return "recommend_topic"
}

func (t *TopicTool) GetToolSchema() *mark3labs.Tool {
	input := mark3labs.ToolInputSchema{
		Type: "object",
		Properties: map[string]interface{}{
			"topics": map[string]interface{}{
				"type":        "string",
				"description": "recommend topics for the output. it should be a json array of topic, eg: [\"topic1\", \"topic2\"]",
				"required":    true,
			},
		},
		Required: []string{"topics"},
	}
	return &mark3labs.Tool{
		Name:        "recommend_topic",
		Description: "recommend topics for the output.",
		InputSchema: input,
	}
}

func (t *TopicTool) Execute(args map[string]interface{}) error {
	topics, ok := args["topics"]
	if !ok {
		return fmt.Errorf("topics is required")
	}
	fmt.Println(topics)
	return nil
}

func (t *TopicTool) GetType() string {
	return "LOCAL"
}
